package controller.Supper;

import pojo.Announcement;
import service.Supper.SuperAnnService;
import service.Supper.SuperGoodsService;
import service.Supper.impl.SuperAnnServiceImpl;
import service.Supper.impl.SuperGoodsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet(name = "SuperAnnServlet",urlPatterns = "/annServlet")
public class SuperAnnServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        PrintWriter out = response.getWriter();
        String action = request.getParameter("action");
        SuperAnnService sas = new SuperAnnServiceImpl();
        if(action!=null  && "anQueryNew".equals(action)){
            List<Announcement> list = sas.SelTitle();
            //System.out.println(list.size());
            request.setAttribute("List", list);
       //     response.sendRedirect("/BeforePage/GUIMEI/anQuery.jsp");
            request.getRequestDispatcher("/BeforePage/GUIMEI/anQuery.jsp").forward(request,response);
        }
    }
}
